$(function(){

    const iframeSrc = sessionStorage.getItem("iframeSrc")

    const _viewRight = {
        "basic.html":{height:"auto",index:0},
        "retrieval.html":{height:"890px",index:1},
        "read.html":{height:"890px",index:2},
        "bookshelf.html":{height:"890px",index:3},
        // "read-info.html":{height:"auto",index:4},
        "set-password.html":{height:"auto",index:4}
    }

    if(iframeSrc){
        $(".center-view  .view-right iframe").attr("src","./personal-center/"+iframeSrc)
        $(".center-view .view-left ul li").children('p').removeClass("active")
        $(".center-view .view-left ul li").eq(_viewRight[iframeSrc].index).children('p').addClass("active") 
    }
    $(".center-view .view-left ul li").click(function(e){   
        const { page } = e.currentTarget.dataset  
        $(".view-right").css({
            height:_viewRight[page].height
        })
        $(this).siblings().children('p').removeClass("active")
        $(this).children('p').addClass("active")
        $(".center-view  .view-right iframe").attr("src","./personal-center/"+page)
        sessionStorage.setItem("iframeSrc",page)
    })


})